<?
$import[] = "DROP TABLE IF EXISTS Band_Diaries";
$import[] = "DROP TABLE IF EXISTS Band_Guest_Performers";
$import[] = "DROP TABLE IF EXISTS Band_Information";
$import[] = "DROP TABLE IF EXISTS Band_Members";
$import[] = "DROP TABLE IF EXISTS Band_News";
$import[] = "DROP TABLE IF EXISTS DarkRoom_Areas";
$import[] = "DROP TABLE IF EXISTS DarkRoom_Categories";
$import[] = "DROP TABLE IF EXISTS DarkRoom_Media";
$import[] = "DROP TABLE IF EXISTS DarkRoom_Media_to_Areas";
$import[] = "DROP TABLE IF EXISTS Genres";
$import[] = "DROP TABLE IF EXISTS Links";
$import[] = "DROP TABLE IF EXISTS Links_Categories";
$import[] = "DROP TABLE IF EXISTS Release_Tracks";
$import[] = "DROP TABLE IF EXISTS Releases";
$import[] = "DROP TABLE IF EXISTS Releases_to_Band_Members";
$import[] = "DROP TABLE IF EXISTS Releases_to_Guest_Performers";
$import[] = "DROP TABLE IF EXISTS Shows";
$import[] = "DROP TABLE IF EXISTS Tours";
$import[] = "DROP TABLE IF EXISTS Users";
$import[] = "DROP TABLE IF EXISTS Venues";
$import[] = "DROP TABLE IF EXISTS Config";

$import[] = "CREATE TABLE Band_Diaries (
  ID mediumint(5) NOT NULL auto_increment,
  title varchar(255) NOT NULL default '',
  member_id mediumint(5) NOT NULL default '0',
  date_time datetime default NULL,
  description tinytext,
  body mediumtext,
  is_active tinyint(1) default NULL,
  PRIMARY KEY  (ID)
)";

$import[] = "CREATE TABLE Band_Guest_Performers (
  ID mediumint(5) NOT NULL auto_increment,
  firstname varchar(255) NOT NULL default '',
  lastname varchar(255) NOT NULL default '',
  function tinytext NOT NULL,
  description mediumtext,
  website varchar(255) default NULL,
  is_active tinyint(1) default NULL,
  PRIMARY KEY  (ID)
)";

$import[] = "CREATE TABLE Band_Information (
  ID mediumint(9) NOT NULL auto_increment,
  name varchar(128) NOT NULL default '',
  bio mediumtext,
  miscellaneous mediumtext,
  genreID mediumint(9) NOT NULL default '0',
  address1 varchar(128) default NULL,
  address2 varchar(128) default NULL,
  city varchar(64) default NULL,
  stateProvince varchar(64) default NULL,
  postalCode varchar(64) default NULL,
  managerName varchar(128) default NULL,
  country varchar(5) default NULL,
  defaultStateProvince varchar(128) default NULL,
  defaultCity varchar(128) default NULL,
  defaultCountry varchar(5) default NULL,
  description mediumtext,
  PRIMARY KEY  (ID)
)";

$import[] = "CREATE TABLE Band_Members (
  ID mediumint(5) NOT NULL auto_increment,
  role varchar(255) NOT NULL default '',
  equipment tinytext,
  influences tinytext,
  bio mediumtext,
  is_active tinyint(1) default NULL,
  photo_area_id mediumint(9) NOT NULL default '0',
  av_area_id mediumint(9) NOT NULL default '0',
  user_id bigint(20) NOT NULL default '0',
  PRIMARY KEY  (ID)
)";

$import[] = "CREATE TABLE Band_News (
  ID mediumint(5) NOT NULL auto_increment,
  title varchar(255) NOT NULL default '',
  user_id int(10) unsigned NOT NULL default '0',
  date_time datetime default NULL,
  description mediumtext,
  body longtext,
  is_active tinyint(1) default NULL,
  PRIMARY KEY  (ID)
)";

$import[] = "CREATE TABLE DarkRoom_Areas (
  ID mediumint(5) NOT NULL auto_increment,
  title varchar(255) NOT NULL default '',
  description mediumtext,
  image_max_width smallint(5) unsigned NOT NULL default '0',
  image_max_height smallint(5) unsigned NOT NULL default '0',
  image_max_thumbnail_width smallint(5) unsigned NOT NULL default '0',
  image_max_thumbnail_height smallint(5) unsigned NOT NULL default '0',
  is_general_media tinyint(1) NOT NULL default '0',
  parent_id mediumint(5) NOT NULL default '0',
  allowed_extensions varchar(255) default NULL,
  display enum('list','grid') NOT NULL default 'list',
  is_active tinyint(1) default '0',
  PRIMARY KEY  (ID)
)";


$import[] = "CREATE TABLE DarkRoom_Categories (
  ID mediumint(5) NOT NULL auto_increment,
  title varchar(255) NOT NULL default '',
  description mediumtext,
  area_id mediumint(5) NOT NULL default '0',
  parent_id mediumint(5) NOT NULL default '0',
  PRIMARY KEY  (ID)
)";



$import[] = "CREATE TABLE DarkRoom_Media (
  ID mediumint(5) NOT NULL auto_increment,
  date_time datetime NOT NULL default '0000-00-00 00:00:00',
  filename varchar(255) NOT NULL default '',
  filename_original varchar(255) default NULL,
  type varchar(5) NOT NULL default '',
  PRIMARY KEY  (ID)
)";



$import[] = "CREATE TABLE DarkRoom_Media_to_Areas (
  ID mediumint(5) NOT NULL auto_increment,
  title varchar(255) NOT NULL default '',
  description mediumtext,
  area_id mediumint(5) NOT NULL default '0',
  media_id mediumint(5) NOT NULL default '0',
  is_active tinyint(1) NOT NULL default '0',
  display_order mediumint(5) NOT NULL default '0',
  is_alias tinyint(1) NOT NULL default '0',
  user_id int(11) NOT NULL default '0',
  access varchar(255) NOT NULL default 'DOWNLOAD',
  protected_filename varchar(255) default NULL,
  PRIMARY KEY  (ID)
)";

$import[] = "CREATE TABLE Config (
  name varchar(255) NOT NULL default '',
  value varchar(255) NOT NULL default '',
  PRIMARY KEY  (name)
)";

$import[] = "CREATE TABLE Genres (
  ID int(10) unsigned NOT NULL auto_increment,
  genreName varchar(128) NOT NULL default '',
  PRIMARY KEY  (ID),
  UNIQUE KEY genreName (genreName)
)";

$import[] = "INSERT INTO Genres VALUES (1,'Rock/Pop')";
$import[] = "INSERT INTO Genres VALUES (2,'Hip-Hop')";
$import[] = "INSERT INTO Genres VALUES (3,'R&B/Soul')";
$import[] = "INSERT INTO Genres VALUES (4,'Electronic/Dance')";
$import[] = "INSERT INTO Genres VALUES (5,'Country')";
$import[] = "INSERT INTO Genres VALUES (6,'Jazz')";
$import[] = "INSERT INTO Genres VALUES (7,'World/Reggae')";
$import[] = "INSERT INTO Genres VALUES (8,'New Age')";
$import[] = "INSERT INTO Genres VALUES (9,'Blues')";
$import[] = "INSERT INTO Genres VALUES (10,'Latin')";
$import[] = "INSERT INTO Genres VALUES (11,'Gospel/Spiritual')";
$import[] = "INSERT INTO Genres VALUES (12,'Bluegrass')";
$import[] = "INSERT INTO Genres VALUES (13,'Vocal/Easy Listening')";
$import[] = "INSERT INTO Genres VALUES (14,'Folk')";
$import[] = "INSERT INTO Genres VALUES (15,'Children\'s')";
$import[] = "INSERT INTO Genres VALUES (16,'Radio/Comedy/Spoken Word')";

$import[] = "CREATE TABLE Links (
  ID int(10) unsigned NOT NULL auto_increment,
  name varchar(128) NOT NULL default '',
  description mediumtext,
  url varchar(255) NOT NULL default '',
  category_id mediumint(5) NOT NULL default '0',
  is_active tinyint(1) NOT NULL default '0',
  PRIMARY KEY  (ID)
)";

$import[] = "CREATE TABLE Links_Categories (
  ID mediumint(5) NOT NULL auto_increment,
  name varchar(255) NOT NULL default '',
  description mediumtext,
  parent_id mediumint(5) NOT NULL default '0',
  is_active tinyint(1) NOT NULL default '0',
  PRIMARY KEY  (ID)
)";

$import[] = "CREATE TABLE Release_Tracks (
  ID mediumint(5) NOT NULL auto_increment,
  title varchar(60) NOT NULL default '',
  meta_information text,
  lyrics mediumtext,
  number int(11) NOT NULL default '0',
  length time default NULL,
  audio_file varchar(255) NOT NULL default '',
  release_id mediumint(5) NOT NULL default '0',
  av_area_id mediumint(9) NOT NULL default '0',
  PRIMARY KEY  (ID)
)";

$import[] = "CREATE TABLE Releases (
  ID mediumint(5) NOT NULL auto_increment,
  title varchar(60) NOT NULL default '',
  sub_title varchar(60) default NULL,
  date date default NULL,
  notes mediumtext,
  press_notes text,
  photo_area_id mediumint(9) NOT NULL default '0',
  is_active tinyint(1) NOT NULL default '0',
  av_area_id mediumint(9) NOT NULL default '0',
  PRIMARY KEY  (ID),
  UNIQUE KEY title (title)
)";

$import[] = "CREATE TABLE Releases_to_Band_Members (
  ID mediumint(5) NOT NULL auto_increment,
  release_id mediumint(5) NOT NULL default '0',
  member_id mediumint(5) NOT NULL default '0',
  PRIMARY KEY  (ID)
)";

$import[] = "CREATE TABLE Releases_to_Guest_Performers (
  ID mediumint(5) NOT NULL auto_increment,
  release_id mediumint(5) NOT NULL default '0',
  guest_performer_id mediumint(5) NOT NULL default '0',
  PRIMARY KEY  (ID)
)";

$import[] = "CREATE TABLE Shows (
  ID mediumint(5) NOT NULL auto_increment,
  date date NOT NULL default '0000-00-00',
  name varchar(48) default NULL,
  time time default NULL,
  other_bands varchar(255) default NULL,
  cost decimal(5,2) default NULL,
  is_all_ages tinyint(1) NOT NULL default '0',
  is_active tinyint(1) NOT NULL default '0',
  notes text,
  user_id int(10) unsigned NOT NULL default '0',
  photo_area_id mediumint(9) NOT NULL default '0',
  venue_id int(10) unsigned NOT NULL default '0',
  av_area_id mediumint(9) NOT NULL default '0',
  PRIMARY KEY  (ID)
)";

$import[] = "CREATE TABLE Tours (
  ID mediumint(5) NOT NULL auto_increment,
  title varchar(255) NOT NULL default '',
  start_date date NOT NULL default '0000-00-00',
  end_date date NOT NULL default '0000-00-00',
  description mediumtext,
  is_active tinyint(1) NOT NULL default '0',
  photo_area_id mediumint(9) NOT NULL default '0',
  av_area_id mediumint(9) NOT NULL default '0',
  PRIMARY KEY  (ID),
  UNIQUE KEY title (title)
)";

$import[] = "CREATE TABLE Users (
  ID bigint(20) unsigned NOT NULL auto_increment,
  username varchar(32) NOT NULL default '',
  password varchar(64) NOT NULL default '',
  email varchar(100) NOT NULL default '',
  level enum('ADMIN','USER') NOT NULL default 'USER',
  firstname varchar(255) NOT NULL default '',
  lastname varchar(255) NOT NULL default '',
  birthdate date default NULL,
  is_active tinyint(1) NOT NULL default '1',
  PRIMARY KEY  (ID)
)";

$import[] = "CREATE TABLE Venues (
  ID int(11) NOT NULL auto_increment,
  address1 varchar(128) default NULL,
  address2 varchar(128) default NULL,
  city varchar(128) default NULL,
  stateProvince varchar(128) default NULL,
  postalCode varchar(30) default NULL,
  country varchar(5) default NULL,
  directions mediumtext,
  name varchar(128) NOT NULL default '',
  is_active tinyint(1) NOT NULL default '0',
  user_id int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (ID)
)";
